// API 响应相关类型定义

// 通用响应结构
export interface ApiResponse<T = any> {
  code: number;
  msg: string;
  data?: T;
  rows?: T[];
}

// 分页响应结构
export interface PageResponse<T = any> {
  code: number;
  msg: string;
  data: {
    list: T[];
    total: number;
    page: number;
    size: number;
  };
}

// 登录相关类型
export interface LoginRequest {
  username: string;
  password: string;
  uuid?: string;
  _t?: number;
}

export interface LoginResponse {
  token: string;
  expire: number;
  userInfo?: UserInfo;
}

export interface UserInfo {
  userId: number;
  username: string;
  nickName?: string;
  avatar?: string;
  email?: string;
  phone?: string;
  deptId?: number;
  deptName?: string;
  roleId?: number;
  roles?: Role[];
  permissions?: string[];
}

export interface Role {
  roleId: number;
  roleName: string;
  roleKey: string;
  dataScope?: string;
}

// 菜单相关类型
export interface MenuItem {
  id: string | number;
  name: string;
  path: string;
  title: string;
  icon?: string;
  component?: string;
  redirect?: string;
  hidden?: boolean;
  keepAlive?: boolean;
  children?: MenuItem[];
  meta?: {
    title: string;
    icon?: string;
    hidden?: boolean;
    keepAlive?: boolean;
    [key: string]: any;
  };
}

// 权限类型
export type Permission = string;

// 字典相关类型
export interface DictItem {
  id: string | number;
  dictCode: string;
  dictLabel: string;
  dictValue: string;
  dictType: string;
  dictSort?: number;
  status?: string;
  remark?: string;
}

// 智能体相关类型
export interface Agent {
  id: string | number;
  name: string;
  keyStr: string;
  addr: string;
  description?: string;
  status?: string;
  createTime?: string;
  updateTime?: string;
  [key: string]: any;
}

export interface AgentListResponse {
  list: Agent[];
  total?: number;
  page?: number;
  size?: number;
}

// 文件上传相关类型
export interface UploadResponse {
  url: string;
  fileName: string;
  originalName: string;
  size: number;
}

// 错误响应类型
export interface ErrorResponse {
  code: number;
  msg: string;
  error?: string;
  timestamp?: string;
  path?: string;
}